package com.zly.service.impl;

import java.io.Serializable;
import java.util.List;

import com.zly.dao.DormDao;
import com.zly.dao.impl.DormDaoImpl;
import com.zly.service.DormService;

public class DormServiceImpl<T> implements DormService<T>{

	/**
	 * 调用dao层实现查询数据
	 */
	@Override
	public List<T> select(Class<T> clazz, String sql) {
		DormDao<T> dormDao = new DormDaoImpl<>();
		return dormDao.select(clazz, sql);
	}
	/**
	 * 调用dao层实现更新数据
	 */
	@Override
	public void update(Object obj) {
		DormDao<T> dormDao = new DormDaoImpl<>();
		dormDao.update(obj);
	}
	/**
	 * 调用dao层实现增加数据
	 */
	@Override
	public void save(Object obj) {
		DormDao<T> dormDao = new DormDaoImpl<>();
		dormDao.save(obj);
	}
	/**
	 * 调用dao层实现根据id删除数据
	 */
	@Override
	public void deleteById(Class<T> clazz, Serializable id) {
		DormDao<T> dormDao = new DormDaoImpl<>();
		dormDao.deleteById(clazz, id);
	}
	/**
	 * 调用dao层实现删除数据
	 */
	@Override
	public void delete(Object obj) {
		DormDao<T> dormDao = new DormDaoImpl<>();
		dormDao.delete(obj);
	}

}
